package com.stedu.mall.common.service.impl;

import com.stedu.mall.common.bean.UserLogin;
import com.stedu.mall.common.exception.MallException;
import com.stedu.mall.common.mapper.UserLoginMapper;
import com.stedu.mall.common.service.UserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserLoginServiceImpl implements UserLoginService {
    @Autowired
    private UserLoginMapper userLoginMapper;
    @Override
    public List<UserLogin> selectByUserName(String username) {
        return userLoginMapper.selectByUsername(username);
    }

    @Override
    public void insert(UserLogin userLogin) throws MallException {
        if (userLoginMapper.insert(userLogin) != 1) {
            throw new MallException("日志生成失败");
        }
    }
}
